<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../../Css/style.css" />
    <script type="text/javascript" src="../../Js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="../../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../../Js/ckform.js"></script>
    <script type="text/javascript" src="../../Js/common.js"></script>
	<script type="text/javascript" src="../../myjQuery/jQuery-getUrlParam.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
    <script>
    $(function(){
    	   $.ajax({
    			type:"post",
    			url:"../../commdidties/findcoclass",
    			contentType:"application/json;charset=utf-8",
    			success:function(coclass){
    				$('#claname')
					.append("<option value='--'>--</option>");
    				for(var i=0;i<coclass.length;i++ ){
    					$('#claname')
    						.append("<option value="+coclass[i].claname+">"+coclass[i].claname+"</option>");
    				}
    			}
    		}); 
    });
    /*点击事件  */
    $(function () {       
		$('#backid').click(function(){
				window.location.href="index.html";
		 });
		$('#commoditiesadd').click(function(){
			var commoditiesString = $('#claname').val()+'-'+
			$('#coid').val()+'-'+
			$('#coname').val()+'-'+
			$('#cophoto').val()+'-'+
			$('#conum').val()+'-'+
			$('#coprice').val()+'-'+
			$('#uid').val();
			//修改商品信息
			$.ajax({
				type:"post",
				url:"../../commdidties/comoditiesadd?commoditiesString="+commoditiesString,
				contentType:"application/json;charset=utf-8",
				success:function(i){
					if(i == "1"){
						alert("添加成成功");
					}else{
						if(i == "2"){
							alert("添加失败");
						}else{
							if(i == "4"){
								alert('归属号不存在');
							}else{
								alert("商品号已存在");	
							}
							}
						}
				}
					});
		});
    });
    </script>
</head>
<body>
<form action="index.html" method="post" class="definewidth m20">
<table class="table table-bordered table-hover m10">
    <tr>
        <td width="10%" class="tableleft">类型</td>
        <td>
            <select name="claname" id="claname"></select>
        </td>
    </tr>
    <tr>
        <td class="tableleft">商品号</td>
        <td><input type="text" name="coid" id="coid"/></td>
    </tr>
    <tr>
        <td class="tableleft">商品名</td>
        <td><input type="text" name="coname" id="coname"/></td>
    </tr>
    <tr>
        <td class="tableleft">商品样式</td>
        <td><input type="text" name="cophoto" id="cophoto"/></td>
    </tr>
    <tr>
        <td class="tableleft">商品数量</td>
        <td><input type="text" name="conum" id="conum"/></td>
    </tr>
    <tr>
        <td class="tableleft">商品价格</td>
        <td><input type="text" name="coprice" id="coprice"/></td>
    </tr>
    <tr>
        <td class="tableleft">商品归属</td>
        <td><input type="text" name="uid" id="uid"/></td>
    </tr>
    <tr>
        <td class="tableleft">状态</td>
        <td>
            <input type="radio" name="status" value="0" disabled="disabled"/> 启用
            <input type="radio" name="status" value="1" disabled="disabled"/> 禁用
        </td>
    </tr>
    <tr>
        <td class="tableleft"></td>
        <td>
            <button type="button" class="btn btn-primary" type="button" id="commoditiesadd">添加</button> &nbsp;&nbsp;
            <button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
        </td>
    </tr>
</table>
</form>
</body>
</html>